﻿import QtQuick 2.15
import QtQuick.Controls 2.15

Item {
    width: screenWidth
    height: screenHeight

    Item{
        id:backGround
        anchors.fill: parent
    }

    Rectangle{
        anchors.fill: backGround
        color: "#09295c"
    }

    Rectangle{
        anchors.top: backGround.top
        anchors.topMargin: 210
        anchors.left: backGround.left
        anchors.leftMargin: 10
        color: "#0b49b0"
        border.width: 1
        border.color: "#008edd"
        width: 1060
        height: 1400


        Text{
            anchors.top: parent.top
            anchors.topMargin: 40
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"刀盘原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 20
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 刀盘原点位置
                id:knifeOrigin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.knifeOriginLocation
            }

            TextInput{
                id:knifeOrigin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:knifeOrigin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     knifeOrigin.text = knifeOrigin_Input.text
                //     knifeOrigin_Input.visible = false
                //     knifeOrigin.visible = true
                // }
                onAccepted: {
                    knifeOrigin_Input.visible = false
                    knifeOrigin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3500",knifeOrigin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    knifeOrigin.visible = false
                    knifeOrigin_Input.visible = true
                    knifeOrigin_Input.forceActiveFocus()
                }
            }
        }

        Text{
            anchors.top: parent.top
            anchors.topMargin: 160
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"胶辊原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 140
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 胶辊原点位置
                id:rollerOrigin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.rollerOriginLocation
            }

            TextInput{
                id:rollerOrigin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:rollerOrigin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     rollerOrigin.text = rollerOrigin_Input.text
                //     rollerOrigin_Input.visible = false
                //     rollerOrigin.visible = true
                // }
                onAccepted: {
                    rollerOrigin_Input.visible = false
                    rollerOrigin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3504",rollerOrigin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    rollerOrigin.visible = false
                    rollerOrigin_Input.visible = true
                    rollerOrigin_Input.forceActiveFocus()
                }
            }
        }
        Text{
            anchors.top: parent.top
            anchors.topMargin: 280
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"压力1原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 260
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 压力1原点位置
                id:stress01Origin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.stress01OriginLocation
            }

            TextInput{
                id:stress01Origin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:stress01Origin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     stress01Origin.text = stress01Origin_Input.text
                //     stress01Origin_Input.visible = false
                //     stress01Origin.visible = true
                // }
                onAccepted: {
                    stress01Origin_Input.visible = false
                    stress01Origin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3508",stress01Origin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    stress01Origin.visible = false
                    stress01Origin_Input.visible = true
                    stress01Origin_Input.forceActiveFocus()
                }
            }
        }

        Text{
            anchors.top: parent.top
            anchors.topMargin: 400
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"压力2原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 380
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 压力2原点位置
                id:stress02Origin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.stress02OriginLocation
            }

            TextInput{
                id:stress02Origin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:stress02Origin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     stress02Origin.text = stress02Origin_Input.text
                //     stress02Origin_Input.visible = false
                //     stress02Origin.visible = true
                // }
                onAccepted: {
                    stress02Origin_Input.visible = false
                    stress02Origin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3512",stress02Origin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    stress02Origin.visible = false
                    stress02Origin_Input.visible = true
                    stress02Origin_Input.forceActiveFocus()
                }
            }
        }
        Text{
            anchors.top: parent.top
            anchors.topMargin: 520
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"压力3原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 500
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 压力3原点位置
                id:stress03Origin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.stress03OriginLocation
            }

            TextInput{
                id:stress03Origin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:stress03Origin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     stress03Origin.text = stress03Origin_Input.text
                //     stress03Origin_Input.visible = false
                //     stress03Origin.visible = true
                // }
                onAccepted: {
                    stress03Origin_Input.visible = false
                    stress03Origin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3516",stress03Origin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    stress03Origin.visible = false
                    stress03Origin_Input.visible = true
                    stress03Origin_Input.forceActiveFocus()
                }
            }
        }
        Text{
            anchors.top: parent.top
            anchors.topMargin: 650
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"前刀1原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 630
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 前刀1原点位置
                id:f_knife01Origin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.f_knife01OriginLocation
            }

            TextInput{
                id:f_knife01Origin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:f_knife01Origin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     f_knife01Origin.text = f_knife01Origin_Input.text
                //     f_knife01Origin_Input.visible = false
                //     f_knife01Origin.visible = true
                // }
                onAccepted: {
                    f_knife01Origin_Input.visible = false
                    f_knife01Origin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3520",f_knife01Origin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    f_knife01Origin.visible = false
                    f_knife01Origin_Input.visible = true
                    f_knife01Origin_Input.forceActiveFocus()
                }
            }
        }
        Text{
            anchors.top: parent.top
            anchors.topMargin: 760
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"前刀2原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 740
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 前刀2原点位置
                id:f_knife02Origin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.f_knife02OriginLocation
            }

            TextInput{
                id:f_knife02Origin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:f_knife02Origin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     f_knife02Origin.text = f_knife02Origin_Input.text
                //     f_knife02Origin_Input.visible = false
                //     f_knife02Origin.visible = true
                // }
                onAccepted: {
                    f_knife02Origin_Input.visible = false
                    f_knife02Origin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3524",f_knife02Origin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    f_knife02Origin.visible = false
                    f_knife02Origin_Input.visible = true
                    f_knife02Origin_Input.forceActiveFocus()
                }
            }
        }
        Text{
            anchors.top: parent.top
            anchors.topMargin: 880
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"前刀3原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 860
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 前刀3原点位置
                id:f_knife03Origin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.f_knife03OriginLocation
            }

            TextInput{
                id:f_knife03Origin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:f_knife03Origin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     f_knife03Origin.text = f_knife03Origin_Input.text
                //     f_knife03Origin_Input.visible = false
                //     f_knife03Origin.visible = true
                // }
                onAccepted: {
                    f_knife03Origin_Input.visible = false
                    f_knife03Origin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3528",f_knife03Origin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    f_knife03Origin.visible = false
                    f_knife03Origin_Input.visible = true
                    f_knife03Origin_Input.forceActiveFocus()
                }
            }
        }
        Text{
            anchors.top: parent.top
            anchors.topMargin: 1000
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"后刀1原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 980
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 后刀1原点位置
                id:b_knife01Origin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.b_knife01OriginLocation
            }

            TextInput{
                id:b_knife01Origin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:b_knife01Origin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     b_knife01Origin.text = b_knife01Origin_Input.text
                //     b_knife01Origin_Input.visible = false
                //     b_knife01Origin.visible = true
                // }
                onAccepted: {
                    b_knife01Origin_Input.visible = false
                    b_knife01Origin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3532",b_knife01Origin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    b_knife01Origin.visible = false
                    b_knife01Origin_Input.visible = true
                    b_knife01Origin_Input.forceActiveFocus()
                }
            }
        }
        Text{
            anchors.top: parent.top
            anchors.topMargin: 1120
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"后刀2原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 1100
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 后刀2原点位置
                id:b_knife02Origin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.b_knife02OriginLocation
            }

            TextInput{
                id:b_knife02Origin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:b_knife02Origin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     b_knife02Origin.text = b_knife02Origin_Input.text
                //     b_knife02Origin_Input.visible = false
                //     b_knife02Origin.visible = true
                // }
                onAccepted: {
                    b_knife02Origin_Input.visible = false
                    b_knife02Origin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3536",b_knife02Origin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    b_knife02Origin.visible = false
                    b_knife02Origin_Input.visible = true
                    b_knife02Origin_Input.forceActiveFocus()
                }
            }
        }
        Text{
            anchors.top: parent.top
            anchors.topMargin: 1240
            anchors.left: parent.left
            anchors.leftMargin: 200
            font.pixelSize: 50
            font.bold: true
            color: "white"
            text:"后刀3原点位置"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 1220
            anchors.left: parent.left
            anchors.leftMargin: 600
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            Text{           // 后刀3原点位置
                id:b_knife03Origin
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.b_knife03OriginLocation
            }

            TextInput{
                id:b_knife03Origin_Input
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: false
                color: "white"
                selectByMouse: true
                maximumLength: 8
                //@disabel-check M16
                // verticalAlignment: Text.verticalAlignment
                horizontalAlignment: Text.horizontalAlignment
                text:b_knife03Origin.text
                // //@disabel-check M16
                // onEditingFinished: {
                //     b_knife03Origin.text = b_knife03Origin_Input.text
                //     b_knife03Origin_Input.visible = false
                //     b_knife03Origin.visible = true
                // }
                onAccepted: {
                    b_knife03Origin_Input.visible = false
                    b_knife03Origin.visible = true
                    Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3540",b_knife03Origin_Input.text)
                }
            }

            MouseArea{
                anchors.fill: parent
                acceptedButtons: Qt.LeftButton
                //@disabel-check M16
                propagateComposedEvents: true

                onClicked: {
                    mouse.accepted = false
                    b_knife03Origin.visible = false
                    b_knife03Origin_Input.visible = true
                    b_knife03Origin_Input.forceActiveFocus()
                }
            }
        }
    }
}
